import { defineConfig, presetUno } from 'unocss';
import presetRemToPx from '@unocss/preset-rem-to-px';
export default defineConfig({
  // UnoCSS 的配置
  presets: [
    presetUno({ preflight: false }),
    presetRemToPx({
      baseFontSize: 4, //rem转px
    }),
  ],
  rules: [
    [/^c-(.*)$/, ([, color]) => ({ color: `#${color}` })],
    [/^bgc-(.*)$/, ([, color]) => ({ 'background-color': `#${color}` })],
    [
      /^p-(\d+)-(\d+)$/,
      ([, topBottom, leftRight]) => ({ padding: `${topBottom}px ${leftRight}px` }),
    ],
    [
      /^m-(\d+)-(\d+)$/,
      ([, topBottom, leftRight]) => ({ margin: `${topBottom}px ${leftRight}px` }),
    ],
  ],
});
